﻿using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Markup;

namespace DistributedVisionRunner.Module.Converters
{
    public class BoolToGridLengthConverter : MarkupExtension, IValueConverter
    {

        public GridLength TrueLength { get; set; }

        public GridLength FalseLength { get; set; }
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            return this;
        }

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var trueFalse = (bool)value;
            return trueFalse ? TrueLength : FalseLength;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}